<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8" />
  <meta name="viewport"
    content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
  <meta name="format-detection" content="telephone=no,email=no,date=no,address=no" />
  <title>云API</title>
  <link rel="stylesheet" type="text/css" href="../css/api.css" />
  <link rel="stylesheet" type="text/css" href="../css/style.css" />
  <link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css" />
  <style>
    html,
    body {
      background-color: #f5f6f6;
    }

    html,
    body {
      background-color: #f5f6f6;
    }

    .empty {
      margin-left: auto;
      margin-right: auto;
      width: 98%;
    }

    .doufu {
      margin-top: 5px;
    }

    .doufu li {
      width: 50%;
      float: left;
    }

    .doufu li div {
      margin: 5px;
      background-color: #fff;
      padding: 10px;
    }

    .ci {
      text-align: left;
      height: 1px;
      line-height: 0px;
    }

    .ci span {
      padding-left: 16px;
      float: right;
    }

    .shu {
      text-align: center;
      font-size: 22px;
      line-height: 30px;
      height: 30px;
      color: #1abc9c;
    }

    .hui {
      color: #555555;
      font-size: 13px;
    }

    .bimg {
      background-image: url(../image/tanhao.png);
      background-size: 16px;
      background-position: right;
      background-repeat: no-repeat;
    }

    .shangcheng {
      background-image: url(../image/shangsheng.png);
      background-size: 16px;
      background-position: left -2px;
      background-repeat: no-repeat;
      width: 24px;
    }

    .xiajiang {
      background-image: url(../image/xiajiang.png);
      background-size: 16px;
      background-position: 0%;
      background-repeat: no-repeat;
      width: 30px;
    }

    .tongjiimg {
      margin-left: auto;
      margin-right: auto;
      width: 95%;
    }

    .tongjiimg img {
      margin-top: 6px;
    }

    .wode {
      background-color: #1abc9c;
      padding: 8px 0px 8px 10px;
      /*  background-image: url(../image/setting_cell_arrow@2x.png); */
      background-size: 10px;
      /* background-position: right 15px center; */
      background-repeat: no-repeat;
    }

    .wode p:nth-child(1) {
      font-size: 18px;
    }

    .wode p {
      line-height: 25px;
      color: #fff;
    }

    .s {
      font-size: 10px;
    }


    [v-cloak] {
      display: none;
    }

    td {
      border: 1px solid transparent !important;
    }
  </style>
</head>

<body>
  <!--  <div class="wode" onclick="openDetail('wode_window.html')">
    <p id="nbdr"></p>
    <p id="nb"></p>
  </div> -->
  <div class="empty" id="count">
    <ul class="doufu" v-cloak>
      <li>
        <div>
          <p class="bimg">
            养护次数
          </p>
          <p class="shu">0</p>
          <p class="ci hui">
            <span class="">次</span>
          </p>
        </div>
      </li>
      <li>
        <div>
          <p class="bimg">
            巡查数量
          </p>
          <p class="shu" id="patrol">
            0
          </p>
          <p class="ci hui">
            <span class="">次</span>
          </p>
        </div>
      </li>
    </ul>
  </div>
  <!-- 通知列表 -->


  <table class="table table-striped" style="border: 0">


    <tbody id="notic" style="border: 0;text-align: center">
      <th colspan="3" style="text-align: center;background-color: #e6e6e6;">通知列表</th>
      <tr style="border: 0">
        <td>标题</td>
        <td>时间</td>
        <td>发送人</td>

      </tr>
      <tr v-for="(n,index) in noticelists">
        <td v-text="n.title"></td>
        <td v-text="n.time"></td>
        <td v-text="n.name"></td>
      </tr>
    </tbody>
  </table>



  <!--<div class="col-md-4">
    <div class="box border lvse">
      <div class="box-title">
        <h4>
          <a>
            &nbsp;通知列表
          </a>
        </h4>
      </div>
      <div class="panel-body" style="background-color: #fff;">
        <table class="table table-striped table-bordered  -hover">
          <thead>
            <tr>
              <th class="s"><i class></i> 标题</th>
              <th class="s"><i class></i>时间</th>
              <th class="s"><i class></i> 发送人</th>
            </tr>
          </thead>
          <tbody id="notic">
            <tr v-for="(n,index) in noticelists">
              <td v-text="n.title"></td>
              <td v-text="n.time"></td>
              <td v-text="n.name"></td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
  </div>-->
  <!-- 巡查未完成列表 -->

  <table class="table table-striped" style="border: 0;text-align: center;">


    <tbody id="ld" style="border: 0">
      <th colspan="3" style="text-align: center;background-color: #e6e6e6;">巡查未完成列表</th>
      <tr style="border: 0">
        <td>巡查名称</td>
        <td>任务情况</td>
        <td>发布时间</td>

      </tr>
      <tr v-for="(l,index) in ld">
        <td v-text="l.source"></td>
        <td v-text="l.situation"></td>
        <td v-text="l.completeTime"></td>
      </tr>
    </tbody>
  </table>



  <!--  <div class="col-md-4">
    <div class="box border lvse">
      <div class="box-title">
        <h4>
          <a>
            &nbsp;巡查未完成
           </a>
        </h4>
      </div>
      <div class="panel-body" style="background-color: #fff;">
        <table class="table table-striped table-bordered table-hover">
          <thead>
            <tr>
              <th class="s"><i class></i> 巡查名称</th>
              <th class="s"><i class></i> 任务情况</th>
              <th class="s"><i class></i> 发布时间</th>
            </tr>
          </thead>
          <tbody id="ld">
            <tr v-for="(l,index) in ld">
              <td v-text="l.source"></td>
              <td v-text="l.situation"></td>
              <td v-text="l.completeTime"></td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
  </div>-->
</body>
<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/vue.js"></script>
<script type="text/javascript" src="../script/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts/dist/echarts.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-gl/dist/echarts-gl.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-stat/dist/ecStat.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts/dist/extension/dataTool.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts/map/js/china.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts/map/js/world.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts/dist/extension/bmap.min.js"></script>
<script type="text/javascript">
  apiready = function () {
    var reg = $api.getStorage("userSession");
    var sids = reg.data.sysRole.sysRoleCode;
    var role = sids.role_number;
    if (role == "manage") {
      var projectid = $api.getStorage("selectpor").id;
    }
   
    var user = $api.getStorage("userSession");
    var userid = $api.getStorage("userSession").data.id;
    var departName = $api.getStorage("userSession").data.enterpriseProjects
      .projectName;
    var userName = $api.getStorage("userSession").data.realName;
    $("#nbdr").text(userName);
    $("#nb").text(departName);

    var qiyeid = $api.getStorage("userSession").data.enterprise.id;
    var proId = $api.getStorage("userSession").data.proId;
    //豆腐块
    $.ajax({
      type: "post",
      //async : false, //同步执行
      url: BaseServiceUrl + "mobile/attendanceCon/findatt_manage.json",
      data: {
        a_tid: user.data.team_id
      },
      dataType: "json", //返回数据形式为json
      success: function (result) {
        console.log(result)
        $api.setStorage("teamAdd", result);
      },
    });
    var count = new Vue({
      el: "#count",
      data: {
        arr: [],
        num: 0
      },
      created: function () {
        $.ajax({
          type: "post",
          //async : false, //同步执行
          url: BaseServiceUrl + "mobile/mainten/sgstatistics.json",
          data: {
            teamid: teamid = $api.getStorage('userSession').data.team_id,
            enterpriseid: qiyeid,
          },
          dataType: "json", //返回数据形式为json
          success: function (result) {
            //alert(JSON.stringify(result));
            count.num = result.data;
          },
        });
        $.ajax({
          type: "post",
          //async : false, //同步执行
          url: BaseServiceUrl + "mobile/home/counts.json",
          data: {
            depart: qiyeid,
            projectid: projectid,
          },
          dataType: "json", //返回数据形式为json
          success: function (result) {
            //alert(JSON.stringify(result));
            if (result != null) {
              count.arr = result;
              for (var s = 0; s < result.length; s++) { }
            }
          },
        });
      },
    });
    //巡查

    $.ajax({
      type: "post",
      //async : false, //同步执行
      url: BaseServiceUrl + "mobile/construction/adminPatrolAll.json",
      data: {
        enterpriseId: qiyeid,
        areaId: projectid,
        receiverId: userid,
      },
      dataType: "json", //返回数据形式为json
      success: function (result) {
        //alert(JSON.stringify(result));
        if (result != null) {
          $("#patrol").text(result.data);
        }
      },
    });


    //通知
    var notice = new Vue({
      el: "#notic",
      data: {
        noticelists: [],
      },
      created: function () {



        api.ajax({
          url: BaseServiceUrl + "mobile/notice/myFindAll.json",
          method: "post",
          data: {
            values: {
              id: userid,
            },
          },
          timeout: 30,
          dataType: "json",
          returnAll: false,
        }, function (ret, err) {

          if (ret.code == 0) {
            for (var i = 0; i < ret.data.length; i++) {

              notice.noticelists.push(ret.data[i]);
            }
          }
        });



        //      $.ajax({
        //        type: "post",
        //        //async : false, //同步执行
        //        url: BaseServiceUrl + "mobile/notice/getfindone.json",
        //        data: {
        //
        //          id: projectid
        //
        //        },
        //        dataType: "json", //返回数据形式为json
        //        success: function (result) {
        //            alert(JSON.stringify(result));
        //       
        //          if (result != null) {
        //            for (var i = 0; i < result.data.length; i++) {
        //               
        //              notice.noticelists.push(result.data[i]);
        //            }
        //          }
        //        },
        //      });
      },
    });



    //巡查未完成列表
    var appss = new Vue({
      el: "#ld",
      data: {
        ld: [],
      },
      created: function () {
        $.ajax({
          type: "post",
          //async : false, //同步执行
          url: BaseServiceUrl + "mobile/construction/unCompleteList.json",
          data: {
            enterpriseId: qiyeid,
            areaId: projectid,
            receiverId: userid,
            proId: proId,
          },
          dataType: "json", //返回数据形式为json
          success: function (result) {
            //alert(JSON.stringify(result));
            if (result != null) {
              for (var i = 0; i < result.obj.length; i++) {
                //alert(result.data[i])
                appss.ld.push(result.obj[i]);
              }
            }
          },
        });
      },
    });
    //日报
    var appsss = new Vue({
      el: "#ldss",
      data: {
        ldss: [],
      },
      created: function () {
        $.ajax({
          type: "post",
          //async : false, //同步执行
          url: BaseServiceUrl + "app/lnsecthistory/xin.json",
          data: {},
          dataType: "json", //返回数据形式为json
          success: function (result) {
            alert(JSON.stringify(result));
            if (result != null) {
              for (var i = 0; i < result.length; i++) {
                //alert(result.data[i])
                appsss.ldss.push(result[i]);
              }
            }
          },
        });
      },
    });
    dianliang(projectid);
  };

  function dianliang(projectid) {
    var user = $api.getStorage("userSession");
    $.ajax({
      type: "post",
      //async : false, //同步执行
      url: BaseServiceUrl + "mobile/home/xuncha.json",
      data: {
        projectid: projectid,
        userid: user.data.id,
      },
      dataType: "json", //返回数据形式为json
      success: function (result) {
        var doms = document.getElementById("witerchart");
        var myCharts = echarts.init(doms);
        var app = {};
        option = null;
        app.title = "xxxxx";
        options = {
          color: ["#3398DB"],
          title: {
            text: "巡查逐月统计",
            left: "center",
            padding: 30,
          },
          tooltip: {
            trigger: "axis",
            axisPointer: {
              // 坐标轴指示器，坐标轴触发有效
              type: "shadow", // 默认为直线，可选为：'line' | 'shadow'
            },
          },
          grid: {
            left: "3%",
            right: "4%",
            bottom: "3%",
            containLabel: true,
          },
          xAxis: [{
            type: "category",
            data: [
              "一月",
              "二月",
              "三月",
              "四月",
              "五月",
              "六月",
              "七月",
              "八月",
              "九月",
              "十月",
              "十一月",
              "十二月",
            ],
            axisTick: {
              alignWithLabel: true,
            },
          },],
          yAxis: [{
            type: "value",
          },],
          series: [{
            name: "次",
            type: "bar",
            barWidth: "60%",
            data: [
              result[0],
              result[1],
              result[2],
              result[3],
              result[4],
              result[5],
              result[6],
              result[7],
              result[8],
              result[9],
              result[10],
              result[11],
            ],
          },],
        };
        if (options && typeof options === "object") {
          myCharts.setOption(options, true);
        }
      },
    });
  }
</script>

</html>